#include "stdafx.h"
#include "MainMenu.h"
#include "gamemanager.h"
#include "playstate.h"

namespace sgGUI
{

	MainMenu::MainMenu(MyGUI::Widget* _parent)
	{
		initialiseByAttributes(this, _parent);
        mstartButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::onStart);
        mendButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MainMenu::onExit);
	}

	MainMenu::~MainMenu()
	{
	}

    void MainMenu::onStart( MyGUI::Widget *sender )
    {
        CGameManager::Instance().SwitchState( new CPlayState() );
    }

    void MainMenu::onExit( MyGUI::Widget *sender )
    {
        CGameManager::Instance().SwitchState( new CExitState() );
    }

} // sgGUI
